@extends('Admin.Layout.main')
@section('content')
<section class="content">
    <div class="row">
        <!-- left column -->
        <div class="col-md-6">
            <!-- general form elements -->
            <div class="box box-primary">
                <div class="box-header with-border">
                    <h3 class="box-title">{{$data['pageOrButton']}} 地区列表管理</h3>
                </div>
                <!-- /.box-header -->
                <!-- form start -->
                @if($data['flag'] == 1)
                <form role="form" action="/admini/area" method="post" id="area-form" enctype="multipart/form-data">
                @elseif($data['flag'] == 2)
                <form role="form" action="/admini/area/{{$data['editList']->id or ''}}" method="post" id="area-form" enctype="multipart/form-data">
                {{ method_field('PUT') }}
                @endif
                    <input type="hidden" name="_token" value="{{csrf_token()}}">
                    <div class="box-body">
                        <div class="form-group datadd-form-show-error has-error" <?php echo !empty($errors->all()) ? 'style="display:block;"' : '';?>><?php echo !empty($errors->all()) ? implode(' ',$errors->all()) : '';?></div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">所属父级栏目</label>
                            <select name="pid" class="form-control">
                                <option value="0_0">顶级</option>
                                @if(!empty($data['pidListStr']))
                                    @foreach($data['pidListStr'] as $k => $v)
                                        @if(!empty($data['editList']->pid) && $data['editList']->pid == $v->id)
                                            <option value="{{$v->id or ''}}_{{$v->path or ''}}" selected="selected">{{$v->name or ''}}</option>
                                        @else
                                            <option value="{{$v->id or ''}}_{{$v->path or ''}}" @if(!empty($_GET['pid']) && $_GET['pid'] == $v->id) selected="selected" @endif>{{$v->name or ''}}</option>
                                        @endif
                                    @endforeach
                                @endif
                            </select>
                        </div>

                        <div class="form-group">
                            <label for="exampleInputEmail1">地区名称</label>
                            <input type="text" placeholder="输入地区名称..." name="name" value="{{$data['editList']->name or ''}}" class="form-control">
                        </div>
                        
                        <div class="form-group">
                            <label for="exampleInputEmail1">地区简称</label>
                            <input type="text" placeholder="输入地区简称..." name="shortname" value="{{$data['editList']->shortname or ''}}" class="form-control">
                        </div>
                        
                        <div class="form-group">
                            <label for="exampleInputEmail1">地区全称</label>
                            <input type="text" placeholder="输入地区地区全称..." name="merger_name" value="{{$data['editList']->merger_name or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">省市区县</label>
                            <select name="level">
                                <option <?php echo !empty($data['editList']->level) && $data['editList']->level == 1 ? 'selected="selected"' : '';?> value="1">省</option>
                                <option <?php echo !empty($data['editList']->level) && $data['editList']->level == 2 ? 'selected="selected"' : '';?> value="2">市</option>
                                <option <?php echo !empty($data['editList']->level) && $data['editList']->level == 3 ? 'selected="selected"' : '';?> value="3">区</option>
                            </select>
                        </div>
                        
                        <div class="form-group">
                            <label for="exampleInputEmail1">拼音</label>
                            <input type="text" placeholder="输入拼音..." name="pinyin" value="{{$data['editList']->pinyin or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">长途区号</label>
                            <input type="text" placeholder="输入拼音..." name="code" value="{{$data['editList']->code or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">邮编</label>
                            <input type="text" placeholder="输入邮编..." name="zip_code" value="{{$data['editList']->zip_code or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">首字母</label>
                            <input type="text" placeholder="输入首字母..." name="first" value="{{$data['editList']->first or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">经度</label>
                            <input type="text" placeholder="输入经度..." name="lng" value="{{$data['editList']->lng or ''}}" class="form-control">
                        </div>
                        <div class="form-group">
                            <label for="exampleInputEmail1">纬度</label>
                            <input type="text" placeholder="输入纬度..." name="lat" value="{{$data['editList']->lat or ''}}" class="form-control">
                        </div>
                    </div>
                    <!-- /.box-body -->

                    <div class="box-footer">
                        <button class="btn btn-primary" type="submit">{{$data['pageOrButton']}}</button>
                        <a href="/admini/area" class="btn bg-olive">返回列表</a>
                    </div>
                </form>
            </div>
            <!-- /.box -->
        </div>
        <!--/.col (left) -->
    </div>
    <!-- /.row -->
</section>
@endsection
@section('privatefooter')
<!-- jquery-validator -->
<script src="{{__BASE__}}/admin/plugins/jquery-validate/jquery.validate.min.js"></script>
<script src="{{__BASE__}}/admin/plugins/jquery-validate/localization/messages_zh.min.js"></script>
<script type="text/javascript" src="{{__BASE__}}/admin/dist/js/form-validate/area.js"></script>
@endsection